home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWViews / FWUnknow.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.4 KB  |  110 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWUnknow.cpp
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWUNKNOW_H
  11. #include "FWUnknow.h"
  12. #endif
  13.  
  14. #ifndef FWCONTXT_H
  15. #include "FWContxt.h"
  16. #endif
  17.  
  18. #ifndef FWRECSHP_H
  19. #include "FWRecShp.h"
  20. #endif
  21.  
  22. #ifndef FWTXTBOX_H
  23. #include "FWTxtBox.h"
  24. #endif
  25.  
  26. //========================================================================================
  27. // Runtime Information
  28. //========================================================================================
  29.  
  30. #ifdef FW_BUILD_MAC
  31. #pragma segment fwgadgts
  32. #endif
  33.  
  34. //========================================================================================
  35. // Class FW_CUnknownView
  36. //========================================================================================
  37.  
  38. FW_DEFINE_AUTO(FW_CUnknownView)
  39.  
  40. //----------------------------------------------------------------------------------------
  41. // FW_CUnknownView::FW_CUnknownView
  42. //----------------------------------------------------------------------------------------
  43.  
  44. FW_CUnknownView::FW_CUnknownView(Environment* ev, 
  45.                                     FW_CSuperView* container, 
  46.                                     ODID viewID,
  47.                                     FW_CRect& bounds, 
  48.                                     FW_CString& className) :
  49.     FW_CSuperView(ev, container, bounds, viewID, bounds.Size(), FW_kNoScrolling),
  50.     fClassName(className)
  51. {    
  52.     // Overrides FW_CSuperView default bindings to keep fixed bounds
  53.     SetBindings(ev, FW_kFixedBounds);
  54.     SetResizeInvalidates(ev, true);
  55.     
  56.     FW_END_CONSTRUCTOR
  57. }
  58.  
  59. //----------------------------------------------------------------------------------------
  60. // FW_CUnknownView::FW_CUnknownView
  61. //----------------------------------------------------------------------------------------
  62.  
  63. FW_CUnknownView::FW_CUnknownView(Environment* ev, 
  64.                                     FW_CSuperView* container, 
  65.                                     ODID viewID,
  66.                                     FW_CRect& bounds, 
  67.                                     FW_CPoint& extent,
  68.                                     FW_EScrollingDirection scrollDir,
  69.                                     FW_CString& className)  :
  70.     FW_CSuperView(ev, container, bounds, viewID, extent, scrollDir),
  71.     fClassName(className)
  72. {    
  73.     // Overrides FW_CSuperView default bindings to keep fixed bounds
  74.     SetBindings(ev, FW_kFixedBounds);
  75.     SetResizeInvalidates(ev, true);
  76.  
  77.     FW_END_CONSTRUCTOR
  78. }
  79.  
  80. //----------------------------------------------------------------------------------------
  81. // FW_CUnknownView::~FW_CUnknownView
  82. //----------------------------------------------------------------------------------------
  83.  
  84. FW_CUnknownView::~FW_CUnknownView()
  85. {
  86.     FW_START_DESTRUCTOR
  87. }
  88.  
  89. //----------------------------------------------------------------------------------------
  90. // FW_CUnknownView::Draw
  91. //----------------------------------------------------------------------------------------
  92.  
  93. void FW_CUnknownView::Draw(Environment* ev, ODFacet* odFacet, ODShape* invalidShape)
  94. {
  95.     FW_CViewContext vc(ev, this, odFacet, invalidShape);
  96.  
  97.     FW_CRect viewRect(FW_kZeroPoint, GetSize(ev));
  98.     
  99.     // Draw a pink rectangle
  100.     FW_CRectShape::RenderRect(vc, viewRect, FW_kFill, FW_CColor(255, 204, 204)); 
  101.     if (IsScrolling(ev) == false)
  102.         FW_CRectShape::RenderRect(vc, viewRect, FW_kFrame, FW_kRGBRed);
  103.     
  104.     // Write the classId in the top left corner 
  105.     FW_CTextBoxShape::RenderTextBox(vc, fClassName, viewRect, 
  106.                         FW_CFont(FW_GetDefaultFontName(), FW_kPlain, FW_IntToFixed(10)));
  107.  
  108. }
  109.  
  110.